<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Customer</title>

<script src="https://cdn.bootcss.com/jquery/3.2.1/jquery.js"></script>

<!-- 最新版本的 Bootstrap 核心 CSS 文件 -->
<link rel="stylesheet" href="https://cdn.bootcss.com/bootstrap/3.3.7/css/bootstrap.min.css" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous">

<!-- 可选的 Bootstrap 主题文件（一般不用引入） -->
<link rel="stylesheet" href="https://cdn.bootcss.com/bootstrap/3.3.7/css/bootstrap-theme.min.css" integrity="sha384-rHyoN1iRsVXV4nD0JutlnGaslCJuC7uwjduW9SVrLvRYooPp2bWYgmgJQIXwl/Sp" crossorigin="anonymous">

<!-- 最新的 Bootstrap 核心 JavaScript 文件 -->
<script src="https://cdn.bootcss.com/bootstrap/3.3.7/js/bootstrap.min.js" integrity="sha384-Tc5IQib027qvyjSMfHjOMaLkfuWVxZxUPnCJA7l2mCWNIpG9mGCD8wGNIcPD7Txa" crossorigin="anonymous"></script>

<script type="text/javascript" src="js/util.js"></script>
<script type="text/javascript" src="js/render.js"></script>
<script type="text/javascript" src="js/customer_opt.js"></script>

</head>
<body>
	<div class="container">
	<form method="POST" action="add_async" id="form_async">
		姓名：<input type="text" name="cname" id="id_name" class="form-control"></br>
		性别：男：<input type="radio" name="sex"  id="id_sex"  value="true" checked="checked"> 女：<input type="radio" name="sex"  id="id_sex" value="false" >  </br>
		工资：<input type="text" name="sal" id="id_sal" class="form-control"></br>
		生日：<input type="date" name="birth" id="id_birth" class="form-control"></br>
	</form>
	<button id="btn_submit"  type="button" class="btn btn-success">提交</button>
	
	
	<table id="customer_table" class="table">
	<tr>
		<th>id</th>
		<th>姓名</th>
		<th>性别</th>
		<th>工资</th>
		<th>生日</th>
		<th>操作</th>
		<th>操作</th>
	</tr>
	</table>
	
	
	<div id="myModal" class="modal fade" tabindex="-1" role="dialog">
  <div class="modal-dialog" role="document">
    <div class="modal-content">
      <div class="modal-header">
        <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
        <h4 class="modal-title">Modal title</h4>
      </div>
      <div class="modal-body">
        <form id="update_form">
        	id:<input type="text" name="id" class="form-control" readonly></input></br>
        	姓名:<input type="text" name="cname" class="form-control"></input></br>
        	男<input type="radio" name="sex" value="true" id="man" class="form-control">女<input type="radio" name="sex" value="false" id="woman" class="form-control"></br>
        	工资:<input type="number" min=0 step=0.01 name="sal" class="form-control"></input></br>
        	生日：    <input type="label" name="birth" class="form-control"></input>
        </form>
      </div>
      <div class="modal-footer">
        <button id="btnCancel" type="button" class="btn btn-default" data-dismiss="modal">取消</button>
        <button id="btnUpdate" type="button" class="btn btn-primary">更新</button>
      </div>
    </div><!-- /.modal-content -->
  </div><!-- /.modal-dialog -->
</div><!-- /.modal -->
	
	</div>
	

	<script type="text/javascript">
		$(function(){
			$("#btn_submit").click(function(){
			var user = formOpt.formToObject("#form_async");
			customerHandler.addCustomer(user,function(res){
				 viewShower.addItem($("#customer_table") ,res);
				});
			});
			
			
			customerHandler.findAllCustomers(function(res){
				viewShower.refreshView($("#customer_table"),res);
			});
		});
	</script>
	
		
	
</body>
</html>